Calls dir.close() if the directory handle is open, and returns a promise that fulfills when disposal is complete.